#include <QApplication>
#include <QDir>
#include <QDebug>
#include <QySciEdit>
#include <Qsci/qscilexercpp.h>

#include "QyLexerFactory.h"

class QyCPPLexerFactory : public QyLexerFactory {
public:
	QyCPPLexerFactory() : QyLexerFactory( "*.h;*.hpp;*.hxx;*.hh;*.c;*.cpp;*.cxx;*.cc" )
		{ p_lexer = new QsciLexerCPP; }
	~QyCPPLexerFactory() { delete p_lexer; }

	QsciLexer * lexer() const { return p_lexer; }

private:
	QsciLexerCPP * p_lexer;

};

inline void createEditor( const QString & fileName ) {

	QySciEdit * edit = new QySciEdit;
	edit->setLexer( QyLexerFactory::lexer(fileName) );
	edit->openFile(fileName);
	edit->show();

}

int main( int argc, char ** argv ) {

	QApplication app( argc, argv );
	new QyCPPLexerFactory;

	createEditor( "src/QyLexerFactory.h" );
	createEditor( "src/QyLexerFactory.cpp" );
	createEditor( "src/Test.cpp" );

	return app.exec();
}
